package com.spc.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.spc.constant.MessageConstant;
import com.spc.entity.Result;
import com.spc.pojo.Menu;
import com.spc.service.MenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
//菜单相关
@RequestMapping("/menu")
@RestController
public class MenuController {
    @Reference
    private MenuService menuService;
    //查询所有菜单
    @RequestMapping("/findAll")
    public Result findAll(){
        try {
            List<Menu> menus = menuService.findAll();
            return new Result(true, MessageConstant.GET_MEMU_SUCCESS,menus);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.GET_MEMU_FAIL);
        }
    }
}
